//
// Created by liushuai on 18-9-8.
//
#include <iostream>
#include <vector>
//错误
using namespace std;
class Friend_circle{
private:
    vector<vector<int>> Relate;
    vector<bool> Visited;
    int count;
public:
    Friend_circle(vector<vector<int>> &r)
    {
        Relate = r;
        count = 0;
        Visited = vector<bool>(Relate.size(),true);

    }
    void DFS(int start);
    void find_circle();
};
void Friend_circle::DFS(int start) {

    for(int i=0;i<Relate.size();i++)
    {
        if(Relate[start][i]==1 && Visited[i])
        {
            Visited[start] = false;
            DFS(i);
        }
    }
}
void Friend_circle::find_circle() {
    int c;
    for(int i=0;i<Relate.size();i++)
    {
        if(Visited[i])
        {
            DFS(i);
            c++;
        }

    }
    cout<<"朋友圈数目为:"<<c<<"\n";
}
int main()
{
    vector<vector<int>> r =
            {{1,0,1,0,0,1},
             {0,1,0,0,0,0},
             {1,0,1,0,1,0},
             {0,0,0,1,0,0},
             {0,0,1,0,1,0},
             {1,0,0,1,0,1}};
    Friend_circle f = Friend_circle(r);
    f.find_circle();

}